package edu.nf.ch07.service.impl;

import edu.nf.ch07.exception.LoginException;
import edu.nf.ch07.service.AuthService;
import edu.nf.ch07.utils.TokenUtils;
import org.springframework.stereotype.Service;

/**
 * @author wangl
 * @date 2025/5/14
 */
@Service("authService")
public class AuthServiceImpl implements AuthService {

    @Override
    public String auth(String account, String password) {
        if("wangl".equals(account) && "123456".equals(password)) {
            return TokenUtils.create(1001);
        }
        throw new LoginException(10000, "账号或密码错误");
    }
}